/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MenuUtama.java
 *
 * Created on Mar 13, 2011, 8:58:54 PM
 */
package bahrie.tokobukuapp.view;

import bahrie.tokobukuapp.entity.Kasir;
import bahrie.tokobukuapp.implement.ImplemKasir;
import bahrie.tokobukuapp.interfaces.InterKasir;
import bahrie.tokobukuapp.koneksi.DatabaseUtilities;
import java.awt.Dimension;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.view.JasperViewer;

/**
 *
 * @author bahrie
 */
public class MenuUtama extends javax.swing.JFrame {

    private Kasir k = new Kasir();
    InterKasir daoKasir;

    /** Creates new form MenuUtama */
    public MenuUtama() {
        initComponents();
        daoKasir = new ImplemKasir();
        menuLogout.setEnabled(false);
        menuMaster.setVisible(false);
        menuTransaksi.setVisible(false);
        menuLaporan.setVisible(false);

    }

    boolean cekLogin(String user, String pass) {
        boolean hasil = false;
        try {
            k = daoKasir.getByUsername(user);
            if (user.equals(k.getUsername()) && pass.equals(k.getPassword())) {
                hasil = true;
            } else {
                hasil = false;
            }
        } catch (SQLException ex) {
            Logger.getLogger(MenuUtama.class.getName()).log(Level.SEVERE, null, ex);
        }
        return hasil;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDialog1 = new javax.swing.JDialog();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtUser = new javax.swing.JTextField();
        btnMasuk = new javax.swing.JButton();
        txtPassword = new javax.swing.JPasswordField();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        menuLogin = new javax.swing.JMenuItem();
        menuLogout = new javax.swing.JMenuItem();
        menuExit = new javax.swing.JMenuItem();
        menuMaster = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        menuTransaksi = new javax.swing.JMenu();
        subPasokBuku = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        menuLaporan = new javax.swing.JMenu();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();

        jDialog1.setTitle("Login");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Autentifikasi"));

        jLabel1.setText("Username :");

        jLabel2.setText("Password :");

        btnMasuk.setText("Login");
        btnMasuk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMasukActionPerformed(evt);
            }
        });

        txtPassword.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtPasswordKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btnMasuk, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtPassword, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE)
                            .addComponent(txtUser, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnMasuk)
                .addContainerGap())
        );

        javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
        jDialog1.getContentPane().setLayout(jDialog1Layout);
        jDialog1Layout.setHorizontalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialog1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jDialog1Layout.setVerticalGroup(
            jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDialog1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("APLIKASI TOKO BUKU SEHATI");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });
        getContentPane().add(jDesktopPane1, java.awt.BorderLayout.CENTER);

        jMenu1.setText("File");

        menuLogin.setText("Login");
        menuLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuLoginActionPerformed(evt);
            }
        });
        jMenu1.add(menuLogin);

        menuLogout.setText("Logout");
        menuLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuLogoutActionPerformed(evt);
            }
        });
        jMenu1.add(menuLogout);

        menuExit.setText("Exit");
        menuExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuExitActionPerformed(evt);
            }
        });
        jMenu1.add(menuExit);

        jMenuBar1.add(jMenu1);

        menuMaster.setText("Master");

        jMenuItem1.setText("Input Buku");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        menuMaster.add(jMenuItem1);

        jMenuItem2.setText("Input Kasir");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        menuMaster.add(jMenuItem2);

        jMenuItem3.setText("Input Distributor");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        menuMaster.add(jMenuItem3);

        jMenuBar1.add(menuMaster);

        menuTransaksi.setText("Transaksi");

        subPasokBuku.setText("Pasok Buku");
        subPasokBuku.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subPasokBukuActionPerformed(evt);
            }
        });
        menuTransaksi.add(subPasokBuku);

        jMenuItem4.setText("Penjualan");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        menuTransaksi.add(jMenuItem4);

        jMenuBar1.add(menuTransaksi);

        menuLaporan.setText("Laporan");

        jMenuItem6.setText("Buku");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        menuLaporan.add(jMenuItem6);

        jMenuItem7.setText("Kasir");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        menuLaporan.add(jMenuItem7);

        jMenuItem8.setText("Distributor");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        menuLaporan.add(jMenuItem8);

        jMenuItem9.setText("Laporan Pasok");
        jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem9ActionPerformed(evt);
            }
        });
        menuLaporan.add(jMenuItem9);

        jMenuItem10.setText("Laporan Penjualan");
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem10ActionPerformed(evt);
            }
        });
        menuLaporan.add(jMenuItem10);

        jMenuBar1.add(menuLaporan);

        jMenu2.setText("Help");

        jMenuItem5.setText("About");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem5);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        InputBuku iBuku = new InputBuku();
        jDesktopPane1.add(iBuku);
        Dimension screenSize = this.getSize();
        Dimension frameSize = iBuku.getSize();
        iBuku.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
        iBuku.setVisible(true);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        InputKasir iKasir = new InputKasir();
        jDesktopPane1.add(iKasir);
        Dimension screenSize = this.getSize();
        Dimension frameSize = iKasir.getSize();
        iKasir.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
        iKasir.setVisible(true);
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        // TODO add your handling code here:
        InputDistributor iDist = new InputDistributor();
        jDesktopPane1.add(iDist);
        Dimension screenSize = this.getSize();
        Dimension frameSize = iDist.getSize();
        iDist.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
        iDist.setVisible(true);
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void subPasokBukuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subPasokBukuActionPerformed
        // TODO add your handling code here:
        TransaksiPasok tPasok = new TransaksiPasok();
        jDesktopPane1.add(tPasok);
        Dimension screenSize = this.getSize();
        Dimension frameSize = tPasok.getSize();
        tPasok.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
        tPasok.setVisible(true);
    }//GEN-LAST:event_subPasokBukuActionPerformed

    private void btnMasukActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMasukActionPerformed
        // TODO add your handling code here:
        if (cekLogin(txtUser.getText(), txtPassword.getText())) {
            txtUser.setText("");
            txtPassword.setText("");
            menuLogin.setEnabled(false);
            menuLogout.setEnabled(true);
            this.setTitle("Nama " + k.getAkses() + " : " + k.getNama() + "  --  APLIKASI TOKO BUKU SEHATI");
            jDialog1.setVisible(false);
            if (k.getAkses().equals("Kasir")) {
                menuTransaksi.setVisible(true);
                subPasokBuku.setVisible(false);
                jMenuItem4.setVisible(true);
                menuLaporan.setVisible(false);
            } else {
                menuTransaksi.setVisible(true);
                menuMaster.setVisible(true);
                menuLaporan.setVisible(true);
            }
        } else {
            JOptionPane.showMessageDialog(this, "Maaf, Username dan password anda tidak sesuai..!", "Kesalahan", JOptionPane.ERROR_MESSAGE);
            txtUser.setText("");
            txtPassword.setText("");
        }
    }//GEN-LAST:event_btnMasukActionPerformed

    private void menuLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuLoginActionPerformed
        // TODO add your handling code here:
        jDialog1.setSize(375, 190);
        jDialog1.setLocationRelativeTo(null);
        jDialog1.setVisible(true);
    }//GEN-LAST:event_menuLoginActionPerformed

    private void menuLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuLogoutActionPerformed
        // TODO add your handling code here:
        menuLogin.setEnabled(true);
        menuTransaksi.setVisible(false);
        menuMaster.setVisible(false);
        menuLogout.setEnabled(false);
        menuLaporan.setVisible(false);
        this.setTitle("APLIKASI TOKO BUKU SEHATI");
    }//GEN-LAST:event_menuLogoutActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        // TODO add your handling code here:
        TransaksiPenjualan tPen = new TransaksiPenjualan(k.getUsername());
        jDesktopPane1.add(tPen);
        Dimension screenSize = this.getSize();
        Dimension frameSize = tPen.getSize();
        tPen.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
        tPen.setVisible(true);
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void menuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuExitActionPerformed
        // TODO add your handling code here:
        System.exit(1);
    }//GEN-LAST:event_menuExitActionPerformed

    private void txtPasswordKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPasswordKeyPressed
        // TODO add your handling code here:
        if (evt.getKeyCode() == evt.VK_ENTER) {
            btnMasukActionPerformed(null);
        }
    }//GEN-LAST:event_txtPasswordKeyPressed

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowActivated

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        // TODO add your handling code here:
        About ab = new About();
        jDesktopPane1.add(ab);
        Dimension screenSize = this.getSize();
        Dimension frameSize = ab.getSize();
        ab.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
        ab.setVisible(true);
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        // TODO add your handling code here:
        jDialog1.setSize(375, 185);
        jDialog1.setLocationRelativeTo(null);
        jDialog1.setVisible(true);
    }//GEN-LAST:event_formWindowOpened

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        try {
            // TODO add your handling code here:
            InputStream is = getClass().getResourceAsStream("/bahrie/tokobukuapp/report/repBarang.jasper");
            HashMap has = new HashMap();
            JasperPrint jasperPrint = JasperFillManager.fillReport(is, has, DatabaseUtilities.getConnection());
            ReportReview rp = new ReportReview(jasperPrint);
            Dimension screenSize = this.getSize();
            Dimension frameSize = rp.getSize();
            rp.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
            rp.setVisible(true);
//        JasperViewer.viewReport(jasperPrint, false);
//            JasperViewer.setDefaultLookAndFeelDecorated(true);
        } catch (JRException ex) {
            Logger.getLogger(MenuUtama.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            InputStream is = getClass().getResourceAsStream("/bahrie/tokobukuapp/report/repKasir.jasper");
            HashMap has = new HashMap();
            JasperPrint jasperPrint = JasperFillManager.fillReport(is, has, DatabaseUtilities.getConnection());
            ReportReview rp = new ReportReview(jasperPrint);
            Dimension screenSize = this.getSize();
            Dimension frameSize = rp.getSize();
            rp.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
            rp.setVisible(true);
//          JasperViewer.viewReport(jasperPrint, false);
//          JasperViewer.setDefaultLookAndFeelDecorated(true);
        } catch (JRException ex) {
            Logger.getLogger(MenuUtama.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
        // TODO add your handling code here:
        try {
            // TODO add your handling code here:
            InputStream is = getClass().getResourceAsStream("/bahrie/tokobukuapp/report/repDistributor.jasper");
            HashMap has = new HashMap();
            JasperPrint jasperPrint = JasperFillManager.fillReport(is, has, DatabaseUtilities.getConnection());
            ReportReview rp = new ReportReview(jasperPrint);
            Dimension screenSize = this.getSize();
            Dimension frameSize = rp.getSize();
            rp.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
            rp.setVisible(true);
//            JasperViewer.viewReport(jasperPrint, false);
//            JasperViewer.setDefaultLookAndFeelDecorated(true);
        } catch (JRException ex) {
            Logger.getLogger(MenuUtama.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem8ActionPerformed

    private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed
        try {
            // TODO add your handling code here:
            InputStream is = getClass().getResourceAsStream("/bahrie/tokobukuapp/report/repPasok.jasper");
            HashMap has = new HashMap();
            JasperPrint jasperPrint = JasperFillManager.fillReport(is, has, DatabaseUtilities.getConnection());
            ReportReview rp = new ReportReview(jasperPrint);
            Dimension screenSize = this.getSize();
            Dimension frameSize = rp.getSize();
            rp.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
            rp.setVisible(true);
        } catch (JRException ex) {
            Logger.getLogger(MenuUtama.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem9ActionPerformed

    private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed
        try {
            // TODO add your handling code here:
            InputStream is = getClass().getResourceAsStream("/bahrie/tokobukuapp/report/repPenjualan.jasper");
            HashMap has = new HashMap();
            JasperPrint jasperPrint = JasperFillManager.fillReport(is, has, DatabaseUtilities.getConnection());
            ReportReview rp = new ReportReview(jasperPrint);
            Dimension screenSize = this.getSize();
            Dimension frameSize = rp.getSize();
            rp.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
            rp.setVisible(true);
        } catch (JRException ex) {
            Logger.getLogger(MenuUtama.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jMenuItem10ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MenuUtama().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnMasuk;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JDialog jDialog1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JMenuItem menuExit;
    private javax.swing.JMenu menuLaporan;
    private javax.swing.JMenuItem menuLogin;
    private javax.swing.JMenuItem menuLogout;
    private javax.swing.JMenu menuMaster;
    private javax.swing.JMenu menuTransaksi;
    private javax.swing.JMenuItem subPasokBuku;
    private javax.swing.JPasswordField txtPassword;
    private javax.swing.JTextField txtUser;
    // End of variables declaration//GEN-END:variables
}
